package com.guangzhi.weijianzhi.adapter;

import java.util.ArrayList;

import com.guangzhi.weijianzhi.R;
import com.guangzhi.weijianzhi.company.center.CompileCompanyInfoActivity;
import com.guangzhi.weijianzhi.entity.BeansCity;
import com.guangzhi.weijianzhi.entity.BeansDistrict;
import com.guangzhi.weijianzhi.entity.BeansProvince;

import android.content.Context;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class MyAddressadapterTwo extends BaseAdapter {
	
	private int posi=-1;
	 ArrayList<BeansCity> citys;
	 private Context context;
	public MyAddressadapterTwo(ArrayList<BeansCity> ci,Context con){
		this.citys = ci;
		this.context = con;
	}
	
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
			return citys.size();
		
	}
	
	@Override
	public Object getItem(int arg0) {
		// TODO Auto-generated method stub
		return null;
	}
	
	public void isSelect(int pos){
		this.posi =pos;
		notifyDataSetChanged();
	}
	
	@Override
	public long getItemId(int arg0) {
		// TODO Auto-generated method stub
		return 0;
	}
	
	@Override
	public View getView(int arg0, View arg1, ViewGroup arg2) {
		// TODO Auto-generated method stub
		
		
		TextView tv = new TextView(context);
		
		
         if(posi == arg0){
        	 tv.setTextColor(context.getResources().getColor(R.color.red));
			
		}else{
			tv.setTextColor(context.getResources().getColor(R.color.black));
		}
		
		
			tv.setPadding(0, 15, 0, 15);
			tv.setGravity(Gravity.CENTER);
			final ArrayList<BeansDistrict> districts = citys.get(arg0).getDistricts();
			tv.setText(citys.get(arg0).getName());
			
			
			
			
		/*tv.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				addreThree_list.setAdapter(new MyAddressadapterThree(districts));
				addreThree_list.setVisibility(View.VISIBLE);
				
			}
		});*/
		return tv;
	}
	
}
